//FirstView Component Constructor
function FirstView() {
	//create object instance, a parasitic subclass of Observable
	var self = Ti.UI.createView();
	var comms = require('com.scoe.gcs.comms');
	//var mapWindow = require('ui/tablet/map');
	//label using localization-ready strings from <app dir>/i18n/en/strings.xml
	var label = Ti.UI.createLabel({
		color:'#000000',
		text:String.format(L('welcome'),'Titanium'),
		height:'auto',
		width:'auto'
	});
	
	var buttonStartService = Ti.UI.createButton({
		title:"Start Service",
		height:'auto',
		width:'auto',
		top:'5px',
		left:'10px'
	});
	
	var buttonStartHud = Ti.UI.createButton({
		title:"Start HUD",
		height:'auto',
		width:'auto',
		top:'5px',
		left:'300px'
	});
	
		var buttonOpenMap = Ti.UI.createButton({
		title:"Open Map",
		height:'auto',
		width:'auto',
		top:'5px',
		left:'400px'
	});
	//self.add(label);
	self.add(buttonStartService);
	self.add(buttonStartHud);
	self.add(buttonOpenMap);
	
	
	//self.add(Comms)
	//Add behavior for UI
	label.addEventListener('click', function(e) {
		alert(e.source.text);
		//var Comms = require('com.scoe.gcs.comms');
		//Comms.startService();
		//comms.setRadioAddress("00:06:66:4B:41:D0");
		comms.bainit();
	});
	
	buttonStartService.addEventListener('click', function(e) {
		//var Comms = require('com.scoe.gcs.comms');
		//Comms.startService();
		//comms.setRadioAddress("00:06:66:4B:41:D0");
		comms.bainit();
	});
	
	buttonStartHud.addEventListener('click', function(e) {
		
		//var Comms = require('com.scoe.gcs.comms');
		//Comms.startService();
		comms.startDemo();
		
	});
	
	
	buttonOpenMap.addEventListener('click', function(e) {
		//mapWindow.open();
	});
	return self;
	
	//Add module
	//var Comms = require('com.scoe.gcs.comms');
}

module.exports = FirstView;
